<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
     <meta content="telephone=no" name="format-detection" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable = no"/>
    <title>米商-{$webseting.web_title}</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/mbusiness.css"  rel="stylesheet">
</head>
<body>
    <header id="header" class="u-header clearfix">
        <div class="u-hd-left f-left">
            <a href="javascript:history.go(-1);" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a>
        </div>
        <div class="u-hd-tit"><span>米商</span></div>
        <div class="u-hd-right f-right"><a href="{:U('wap/index/category')}" mars_sead="nav_home_btn"><span class="u-icon-m i-hd-home"></span></a></div>
    </header>
    <div class="filter">
        <ul>
            <li id="listCategory" class="all_chk"><span>全部</span></li>
            <li id="listBrand"><a href="{:U('wap/index/category')}"><span>分类{$typename}</span></a></li>
            <li class="zhekou" data="0"><span>折扣</span></li>
        </ul>
    </div>

    <div id="shop-list" class="more_html">

    <volist name="list" id="vo">
        <article class="row shop-list">
            <a href="{:U('wap/shop/shopdetail',array('id'=>$vo['shop_id']))}">
                <div class="row a-head">
                    <img src="{:U('wap/index/get_thumbs',array('auto'=>240))}?img={$vo.logo}">
                    <div class="a-head-content"><h1>{$vo.shop_name}</h1><mark>{$vo.addr}</mark><p>{$vo.business}</p></div>
                </div>
                {$vo.goods_html}
            </a>
        </article>
      </volist>  
       
    </div>

    

    <div class="b_q">
        <div class="fm-footer-copyright get_more">
            <if condition="$count gt 10 && count($list) eq 10">
                  加载更多
              <else/>  
                 无更多数据
            </if>
        </div>
    </div>
     <input type="hidden" name="p" value="2" />
     <input type="hidden" name="type" value="{$_GET['type']}" />
     <input type="hidden" name="order" value="" />
    <!--end 版权-->
    <div class="bottom-to-top" style="display: block; transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
        <img src="__PUBLIC__/wap/img/scroll-to-top-icon.png" style="width: 100%;">
    </div>
    <!--end top-->
   <include file="Public/footer" />
    <!--end 页脚-->
<script src="__PUBLIC__/bootstrap/vendor/jquery/jquery.min.js"></script>
 <script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
   $(function(){
     $(".get_more").click(function(){
        get_more();
     });
     $(".all_chk").click(function(){
        $("input[name='p']").val(1);
        $("input[name='type']").val("");
        get_more();
     });
     $(".zhekou").click(function(){
        var data=$(this).attr('data');
        var zk="";
        if(data==1){
            $(this).attr('data','2')
            zk="zhekou1";
        }else{
          $(this).attr('data','1')
           zk="zhekou2";
        }
        $("input[name='p']").val(1);
        $("input[name='order']").val(zk);
        get_more();
     });
 
   }); 
   function get_more(){
     var p=$("input[name='p']").val();
     var type=$("input[name='type']").val();
     var order=$("input[name='order']").val();
           $.ajax({ 
            url: "{:U('wap/shop/index')}",
            type:'get',
            data: {p:p,type:type,order:order},
            dataType: 'json',
            success: function(data){
              //console.log(data);
               var con=1;
              var option='';
              if(data){
                 $.each(data, function(i, value) {
                //this指向当前元素
                //i表示Array当前下标
                //value表示Array当前元素
                 option=option+'<article class="row shop-list">'
                    +'<a href="<?php echo U('wap/shop/shopdetail'); ?>?id='+value.shop_id+'">'
                    +'   <div class="row a-head">'
                    +'       <img src="<?php echo U('wap/index/get_thumbs',array('auto'=>240)); ?>?img='+value.logo+'">'
                    +'        <div class="a-head-content"><h1>'+value.shop_name+'</h1><mark>'+value.addr+'</mark><p>'+value.business+'</p></div>'
                    +'    </div>'
                    +value.goods_html
                    +'  </a>'
                    +' </article>';
                    con++;
                 });
                }
                if(p==1){
                 $('.more_html').html(option);
                }else{
                 $('.more_html').append(option);
                }
                $("input[name='p']").val(parseInt(p)+1);

              if(con<10){
                 $('.get_more').html('无更多数据');
              }
            }
           });
   }
</script>
</body>
</html>